package cn.fyl.Lx;

import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class SyncProducer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("group_name");

        producer.setNamesrvAddr("localhost:9876");

        producer.start();

        Message message = new Message("topic", "热死".getBytes(StandardCharsets.UTF_8));

        SendResult send = producer.send(message);

        System.out.println(send);

        producer.shutdown();
    }
}
